package ophiux.api.sdk.request;

import ophiux.api.sdk.domain.OphiuxObject;
import ophiux.api.sdk.response.OphiuxResponse;

public abstract class OphiuxBaseRequest<T extends OphiuxResponse> {
	
	protected OphiuxObject businessModel;
	protected String businessParam;
	protected String p_format="xml";
	
	public abstract String getApiMethod();
	
	public abstract String getApiVersion();
	
	public abstract String getTextParam();
	
	public abstract Class<T> getResponseClass();

	/**
	 * 
	 * @param requestHead
	 * @param paramXML
	 * @return
	 */
	public String toRequestParam(WsRequestHeader requestHead,String paramXML){
		String requestXML = "<OPHIUX>"+
					"<HEAD>"+ 
					"<USER_NAME>"+requestHead.getUSER_NAME()+"</USER_NAME>"+
					"<USER_PWD>"+requestHead.getUSER_PWD()+"</USER_PWD>"+					
					"<TOKEN>"+requestHead.getTOKEN()+"</TOKEN>"+
					"<R_FORM>"+requestHead.getR_FORM()+"</R_FORM>"+
				"</HEAD>"+
				"<PARAM>"+
					paramXML+ 
				"</PARAM>"+
			"</OPHIUX>";
		return requestXML;
	}

	public OphiuxObject getBusinessModel() {
		return businessModel;
	}

	public void setBusinessModel(OphiuxObject businessModel) {
		this.businessModel = businessModel;
	}

	public String getBusinessParam() {
		return businessParam;
	}

	public void setBusinessParam(String businessParam) {
		this.businessParam = businessParam;
	}

	public String getP_format() {
		return p_format;
	}

	public void setP_format(String p_format) {
		this.p_format = p_format;
	}
	
}
